<%- include header %>
<script type="text/javascript" src="/xheditor/xheditor-1.2.2.min.js"></script>
<script type="text/javascript" src="/xheditor/xheditor_lang/zh-cn.js"></script>
<script type="text/javascript">
    $(pageInit);

    function pageInit() {
        $.extend(XHEDITOR.settings, {shortcuts: {'ctrl+enter': submitForm}});
        $('#content').xheditor({
            html5Upload: false,
            upMultiple: '1',
            upLinkUrl: "upload.php",
            upLinkExt: "zip,rar,txt",
            upImgUrl: "/uploadImg",
            upImgExt: "jpg,jpeg,gif,png",
            upFlashUrl: "upload.php",
            upFlashExt: "swf",
            upMediaUrl: "upload.php",
            upMediaExt: "wmv,avi,wma,mp3,mid"
        });
    }

    function insertUpload(arrMsg) {
        console.log(arrMsg)
        var i, msg;
        for (i = 0; i < arrMsg.length; i++) {
            msg = arrMsg[i];
            $("#uploadList").append('<option value="' + msg.id + '">' + msg.localname + '</option>');
        }
    }

    function submitForm() {
        $('#frmDemo').submit();
    }
</script>
<table align='center' border="1">
    <tr>
        <td align="center" colspan="2"><%= rs[0].title %></td>
    </tr>
    <tr>
        <td rowspan="2" valign="top"><%= rs[0].uname %></td>
    </tr>
    <tr>
        <td><%- rs[0].content %></td>
    </tr>

    <% re.forEach(function (row) { %>
    <tr>
        <td rowspan="2" valign="top"><%= row.nicheng %></td>
    </tr>
    <tr>
        <td><%- row.content %></td>
    </tr>
    <% }) %>
    <tr>
        <td colspan="2" align="center">
            <form method="post" action="/question/reply">
                <% if(loginBeans == undefined){ %>
                请<a href="javascript:document.getElementById('loginBtn').click()">登录</a>后发表回答
                <% }else{ %>
                <textarea id="content" name="content" cols="120" rows="9"></textarea>
                <br/>
                <input type="text" hidden="hidden" name="qid" value="<%= rs[0].qid %>">
                <input type="submit" value="回答"/>
                <% } %>
            </form>
        </td>
    </tr>
</table>
<!-------------------登录注册模态框------------------------------>
<div class="modal fade" id="loginModal" style="width:1080px;">
    <div class="modal-dialog">
        <div class="modal-content" style="width:860px;">
            <!--------href内容----------------->

            <!--------------------------------->
        </div>
    </div>
</div>
<!--------------------------------------------------------------->
</body>
</html>